package com.ll.method;

/**
 * @author 刘龙
 * @version 1.0
 */
public class ThreadMethod03 {
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            System.out.println("hi" + i + Thread.currentThread().getName());

            Thread.sleep(1000);
            if (i == 5) {
                T3 t3 = new T3();
                Thread thread = new Thread(t3);
                thread.start();
                thread.join();
                System.out.println("子线程执行完毕");
            }
        }
    }
}

class T3 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("hello" + i + Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

